package com_1;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class Tset {
    public static void main(String[] args) {
        HashMap<String, Student> map = new HashMap<String, Student>();
        Student s1 = new Student("李四", 18);
        Student s2 = new Student("王五", 20);
        Student s3 = new Student("张三", 21);
        map.put("1",s1);
        map.put("2",s2);
        map.put("3",s3);
        Set<String> s4 = map.keySet();
        for (String s : s4) {
            Student s5 = map.get(s);
            System.out.println(s+s5.getName()+s5.getAge());
        }
        System.out.println("------------");
        Set<Map.Entry<String, Student>> entries = map.entrySet();
        for (Map.Entry<String, Student> entry : entries) {
            String key = entry.getKey();
            Student value = entry.getValue();
            System.out.println( key+value.getName()+value.getAge());
        }


    }
}
